package com.designoutput.ui.options.components
{
	import com.designoutput.manager.ResourceManager;
	import com.designoutput.ui.controls.Literal;
	import com.designoutput.ui.controls.NumberInput;
	import com.designoutput.ui.options.BaseOption;
	
	import flash.display.Sprite;
	
	/**
	 * A simple text title, to show basic information such as (x,y,w,h) to users, 
	 * will show data based on the current edited element.
	 * 
	 */	
	public class ElementBaseInfo extends Sprite
	{
		private var baseOption:BaseOption;
		
		public var positionTitle:Literal;
		public var sizeTitle:Literal;
		public var skewTitle:Literal;
		
		private var posXInput:NumberInput;
		private var posYInput:NumberInput;
		private var widthInput:NumberInput;
		private var heightInput:NumberInput;
		private var skewXInput:NumberInput;
		private var skewYInput:NumberInput;
		
		public function ElementBaseInfo(baseOption:BaseOption)
		{
			this.baseOption = baseOption;
			
			positionTitle = new Literal(ResourceManager.getValue("rm_base_position_title"));
			positionTitle.x = 0;
			positionTitle.y = 0;
			addChild(positionTitle);
			
			posXInput = new NumberInput(55,0,0,83.3,true);
			posXInput.x = 0;
			posXInput.y = 20;
			addChild(posXInput);
				
			posYInput = new NumberInput(55,0,0,83.3,true);
			posYInput.x = 60;
			posYInput.y = 20;
			addChild(posYInput);
			
			sizeTitle = new Literal(ResourceManager.getValue("rm_base_size_title"));
			sizeTitle.x = 0;
			sizeTitle.y = 37;
			addChild(sizeTitle);

			widthInput = new NumberInput(55,0,0,83.3,true);
			widthInput.x = 0;
			widthInput.y = 57;
			addChild(widthInput);
				
			heightInput = new NumberInput(55,0,0,83.3,true);
			heightInput.x = 60;
			heightInput.y = 57;
			addChild(heightInput);
			
			skewTitle = new Literal("Skew (x, y)");
			skewTitle.x = 0;
			skewTitle.y = 74;
			addChild(skewTitle);
			
			skewXInput = new NumberInput(55,0,0,83.3,true);
			skewXInput.x = 0;
			skewXInput.y = 94;
			addChild(skewXInput);
			
			skewYInput = new NumberInput(55,0,0,83.3,true);
			skewYInput.x = 60;
			skewYInput.y = 94;
			addChild(skewYInput);
		}
		
		public function setPositionTitle(title:String):void{
			positionTitle.text = title;
		}
		
		public function setSizeTitle(title:String):void {
			sizeTitle.text = title;
		}
		
		public function setBaseInfor(x:Number, y:Number, w:Number, h:Number, skewX:Number, skewY:Number):void{
			posXInput.text = x.toString();
			posYInput.text = y.toString();
			widthInput.text = w.toString();
			heightInput.text = h.toString();
			skewXInput.text = skewX.toString();
			skewYInput.text = skewY.toString();
		}
	}
}